package com.dm.cloud.core.config;

import cn.hutool.core.util.StrUtil;
import com.dm.cloud.core.util.RequsetArrtibutesUtil;
import feign.RequestInterceptor;
import feign.RequestTemplate;

public class CustomFeignRequestInterceptor implements RequestInterceptor {

    @Override
    public void apply(RequestTemplate requestTemplate) {
        if(StrUtil.isNotEmpty(RequsetArrtibutesUtil.get(CommonConstants.AUTH_HEAD_KEY))){
            requestTemplate.header( CommonConstants.AUTH_HEAD_KEY, (String) RequsetArrtibutesUtil.get(CommonConstants.AUTH_HEAD_KEY));
        }
    }
}
